﻿#define _CRT_SECURE_NO_WARNINGS 1


#include <iostream>

using namespace std;

using i64 = long long;

const int N = 100010;

int p[N];
i64 d[N];
int n, m, q;

int find(int x) {
    if (x != p[x]) {
        int r = find(p[x]);
        d[x] += d[p[x]];
        p[x] = r;
    }
    return p[x];
}

void merge(int x, int y, i64 k) {
    int px = find(x), py = find(y);
    p[px] = py;
    d[px] = -d[x] + d[y] + k;
}

int main() {
    cin.tie(0)->sync_with_stdio(false);
    cin >> n >> m >> q;
    for (int i = 0; i <= n; i++) p[i] = i;
    while (m--) {
        int l, r;
        i64 k;
        cin >> l >> r >> k;
        merge(r, --l, k);
    }
    while (q--) {
        int l, r;
        cin >> l >> r;
        int x = find(--l), y = find(r);
        if (x != y) cout << "UNKNOWN\n";
        else cout << d[r] - d[l] << '\n';
    }

    return 0;
}



